package com.vchecker.iobd_checker.utils;

import android.app.Dialog;
import android.content.Context;

import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.List;

public class VDialog extends Dialog {
	public static final int RESULT_OK = 0;
	public static final int RESULT_CANCEL= 1;
	public static final int RESULT_CONFIG= 2;
	public static final int RESULT_CONTINUE= 3;

	/** @Fields mResult : 对话框返回标志 */
	public int mResult = -1;

	/** @Fields mSingleChoiceIndex : 单选列表索引 */
	public int mSingleChoiceIndex = -1;

	/** @Fields mfValue : 浮点数值 */
	public float mfValue = 0;
	public String msValue = "";

	/** @Fields mShowMore : 是否显示更多按钮 */
	public boolean mShowMore = false;

	public List<Boolean> mlistSelItems = new ArrayList<Boolean>();

	public Map<String,Integer> mMapIntValue = new HashMap<String,Integer>();

	public VDialog(Context context, int theme) {
		super(context, theme);
		// TODO Auto-generated constructor stub

	}
	public void setResult(int result){
		mResult = result;
	}
	public int getResult(){
		return mResult;
	}

	public void setSingleChoiceIndex(int index){
		mSingleChoiceIndex = index;
	}
	public int getSingleChoiceIndex(){
		return mSingleChoiceIndex;
	}

	public void setMultiChoice(List<Boolean> listItem){
		for(int i=0;i<listItem.size();i++)
			mlistSelItems.add(listItem.get(i));
	}
	public List<Boolean> getMultiChoice(){
		return mlistSelItems;
	}

	public void setShowMore(boolean enable){
		mShowMore = enable;
	}
	public boolean getShowMore(){
		return mShowMore;
	}

	public void setfValue(float value){
		mfValue = value;
	}
	public float getfValue(){
		return mfValue;
	}

	public void setsValue(String value){
		msValue = value;
	}
	public String getsValue(){
		return msValue;
	}

	public void setIntValue(String name,int value){
		mMapIntValue.put(name,value);
	}
	public int getIntValue(String name,int defaultValue){
		if(mMapIntValue.containsKey(name)){
			return mMapIntValue.get(name);
		} else {
			return defaultValue;
		}
	}
}
